package ksl.healthboy;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TabHost;

public class MainPage extends TabActivity {
    
	private TabHost tabHost;
	private Button addItem;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        //탭 설정
        tabHost = getTabHost();
        LayoutInflater inflater = LayoutInflater.from(this);
        inflater.inflate(R.layout.main, tabHost.getTabContentView(),true);
        
        tabHost.addTab(tabHost.newTabSpec("HOME").setIndicator("Home").setContent(R.id.Layout_Home));
        tabHost.addTab(tabHost.newTabSpec("LIST").setIndicator("List").setContent(R.id.Layout_List));
        tabHost.addTab(tabHost.newTabSpec("GRAPH").setIndicator("Graph").setContent(R.id.Layout_Graph));
        tabHost.addTab(tabHost.newTabSpec("OPTION").setIndicator("Option").setContent(R.id.Layout_Option));
        
        //Home 탭 버튼 설정
        addItem = (Button)findViewById(R.id.btn_AddItem);
        addItem.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO 아이템 추가 페이지 호출
				Intent callAddPage = new Intent(MainPage.this,AddPage.class);
				startActivity(callAddPage);	
			}
		});
        
    }
}